//文章接口
import API from '../index.js'

//查询
export function get(data) {
    return API({
        url: '/admin/post/page',
        method: 'get',
        params: data,
    })
}

//删除
export function del(data) {
    return API({
        url: '/admin/post',
        method: 'delete',
        data: data,
    })
}

//编辑
export function put(data) {
    return API({
        url: '/admin/post',
        method: 'put',
        data: data,
    })
}

//添加
export function add(data) {
    return API({
        url: '/admin/post',
        method: 'post',
        data: data,
    })
}

/*******************************************用户**************************************/
//用户查看所有文章列表
export function list(data) {
    return API({
        url: '/regular/post/page',
        method: 'get',
        params: data,
    })
}


//用户根据文章id查找文章
export function getById(data) {
	const url = `/regular/post/${data}`
	return API({
		url: url,
		method: 'get',
		data:data
	})
}

//用户上传文章
export function uAdd(data) {
    return API({
        url: '/regular/post',
        method: 'post',
        data: data,
    })
}

//根据用户id获取文章分页查询
export function pageByUid(data) {
    return API({
        url: '/regular/post/pageByuserId',
        method: 'get',
        params: data,
    })
}

//用户修改文章
export function uPut(data) {
    return API({
        url: '/regular/post',
        method: 'put',
        data: data,
    })
}

//用户删除文章
export function uDel(data) {
    return API({
        url: '/regular/post',
        method: 'del',
        data: data,
    })
}
